//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

package 力扣.题库.未分类;

public class demo_867 {
    public demo_867() {
    }

    public static void main(String[] args) {
        int[][] matix = new int[][]{{1, 2, 3}, {4, 5, 6}};
        int[][] res = transpose(matix);

        for(int[] re : res) {
            for(int i : re) {
                System.out.println(i);
            }
        }

    }

    public static int[][] transpose(int[][] matrix) {
        int[][] res = new int[matrix[0].length][matrix.length];

        for(int i = 0; i < res.length; ++i) {
            for(int j = 0; j < res[i].length; ++j) {
                res[i][j] = matrix[j][i];
            }
        }

        return res;
    }
}
